#include "mkvstreamaudio.hpp"
#include "mkvcontext.hpp"
#include "ac3parser.hpp"

namespace MkvMux
{

class MkvStreamAudioAc3 : public MkvStreamAudio
{
    MkvStreamAudioAc3(const MkvStreamAudioAc3&);
    MkvStreamAudioAc3& operator=(const MkvStreamAudioAc3&);
    
protected:

    void WriteTrackName();
    void WriteTrackCodecID();
    void WriteTrackCodecName();

public:

    MkvStreamAudioAc3(MkvContext&, const BYTE*, ULONG);
    
    HRESULT Receive(IMediaSample*);
    int EndOfStream();
    void Flush();
    
private:

    Ac3Parser m_parser;

    class Ac3Frame : public AudioFrame
    {
        Ac3Frame& operator=(const Ac3Frame&);
      
    private:
        Ac3Parser::Frame* const m_pFrame;

    public:
        explicit Ac3Frame(Ac3Parser::Frame*);
        ~Ac3Frame();

        ULONG curr_timecode_ms() const;

        ULONG size() const;
        const BYTE* data() const;
      
    };
   
};

}  //end namespace MkvMux
